<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>ATSbufread</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="ATSaddnz.html" title="ATSaddnz" />
    <link rel="next" href="ATScross.html" title="ATScross" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">ATSbufread</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="ATSaddnz.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="ATScross.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="ATSbufread"></a>
      <div class="titlepage"></div>
      <a id="IndexATSbufread" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">ATSbufread</span>
        </h2>
        <p>ATSbufread —  reads data from and ATS data file and stores it in an internal data table of frequency, amplitude pairs.
                    </p>
      </div>
      <div class="refsect1">
        <a id="idp90490672"></a>
        <h2>Description</h2>
        <p>
            <span class="emphasis"><em>ATSbufread</em></span> reads data from and ATS data file and stores it in an internal data table of frequency, amplitude pairs.
        </p>
      </div>
      <div class="refsect1">
        <a id="idp90492368"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>ATSbufread</strong></span> ktimepnt, kfmod, iatsfile, ipartials[, ipartialoffset, \
          ipartialincr]</pre>
      </div>
      <div class="refsect1">
        <a id="idp90494480"></a>
        <h2>Initialization</h2>
        <p>
        <span class="emphasis"><em>iatsfile</em></span> – the ATS number (n in ats.n) or the name in quotes of the analysis file made using <a class="ulink" href="http://www-ccrma.stanford.edu/~juan/ATS.html" target="_top"><em class="citetitle">ATS</em></a>.
        </p>
        <p><span class="emphasis"><em>ipartials</em></span> – number of partials that will be used in the resynthesis (the noise has a maximum of 25 bands)
        </p>
        <p><span class="emphasis"><em>ipartialoffset</em></span> (optional) – is the first partial used (defaults to 0).
        </p>
        <p><span class="emphasis"><em>ipartialincr</em></span> (optional) – sets an increment by which these synthesis opcodes counts up from <span class="emphasis"><em>ipartialoffset</em></span> for ibins components in the re-synthesis (defaults to 1).
        </p>
      </div>
      <div class="refsect1">
        <a id="idp90500096"></a>
        <h2>Performance</h2>
        <p><span class="emphasis"><em>ktimepnt</em></span> – The time pointer in seconds used to index the ATS file. Used for <span class="emphasis"><em>ATSbufread</em></span> exactly the same as for <a class="link" href="pvoc.html" title="pvoc"><em class="citetitle">pvoc</em></a>.</p>
        <p>
        <span class="emphasis"><em>kfmod</em></span> – an input for performing pitch transposition or frequency modulation on all of the synthesized partials, if no fm or pitch change is desired then use a 1 for this value.
        </p>
        <p><span class="emphasis"><em>ATSbufread</em></span> is based on pvbufread by Richard Karpen. <a class="link" href="ATScross.html" title="ATScross"><em class="citetitle">ATScross</em></a>, <a class="link" href="ATSinterpread.html" title="ATSinterpread"><em class="citetitle">ATSinterpread</em></a> and <a class="link" href="ATSpartialtap.html" title="ATSpartialtap"><em class="citetitle">ATSpartialtap</em></a> are all dependent on <span class="emphasis"><em>ATSbufread</em></span> just as <a class="link" href="pvcross.html" title="pvcross"><em class="citetitle">pvcross</em></a> and <a class="link" href="pvinterp.html" title="pvinterp"><em class="citetitle">pvinterp</em></a> are on <a class="link" href="pvbufread.html" title="pvbufread"><em class="citetitle">pvbufread</em></a>. <span class="emphasis"><em>ATSbufread</em></span> reads data from and ATS data file and stores it in an internal data table of frequency, amplitude pairs. The data stored by an <span class="emphasis"><em>ATSbufread</em></span> can only be accessed by other unit generators, and therefore, due to the architecture of Csound, an <span class="emphasis"><em>ATSbufread</em></span>  must come before (but not necessarily directly) any dependent unit generator. Besides the fact that <span class="emphasis"><em>ATSbufread</em></span> doesn't output any data directly, it works almost exactly as <a class="link" href="ATSadd.html" title="ATSadd"><em class="citetitle">ATSadd</em></a>. The ugen uses a time pointer (<span class="emphasis"><em>ktimepnt</em></span>) to index the data in time, <span class="emphasis"><em>ipartials</em></span>, <span class="emphasis"><em>ipartialoffset</em></span> and <span class="emphasis"><em>ipartialincr</em></span> to select which partials to store in the table and <span class="emphasis"><em>kfmod</em></span> to scale partials in frequency.
        </p>
      </div>
      <div class="refsect1">
        <a id="idp90516512"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the ATSbufread opcode. It uses the file <a class="ulink" href="examples/ATSbufread.csd" target="_top"><em class="citetitle">ATSbufread.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp90518368"></a>
          <p class="title">
            <strong>Example 63. Example of the ATSbufread opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;RT audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc for RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o ATSbufread.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1	<span class="comment">; "beats.ats" and  "fox.ats" are created by atsa</span>

ktime	<span class="opc">line</span>	0, p3, 4
ktime2	<span class="opc">line</span>	0, p3, 4
kline	<span class="opc">expseg</span>	0.001, .3, 1, p3<span class="op">-</span>.3, 1
kline2	<span class="opc">expseg</span>	0.001, p3, 3
  	<span class="opc">ATSbufread</span> ktime2, 1, "fox.ats", 20
aout	<span class="opc">ATScross</span>   ktime, 2, "beats.ats", 1, kline, 0.001 <span class="op">*</span> (4 <span class="op">-</span> kline2), 180
	<span class="opc">outs</span> aout<span class="op">*</span>2, aout<span class="op">*</span>2

<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">; sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="stamnt">i</span> 1 0 4 
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>See also the examples for <a class="link" href="ATScross.html" title="ATScross"><em class="citetitle">ATScross</em></a>, <a class="link" href="ATSinterpread.html" title="ATSinterpread"><em class="citetitle">ATSinterpread</em></a> and <a class="link" href="ATSpartialtap.html" title="ATSpartialtap"><em class="citetitle">ATSpartialtap</em></a></p>
      </div>
      <div class="refsect1">
        <a id="idp90523360"></a>
        <h2>See also</h2>
        <p><a class="link" href="ATSread.html" title="ATSread"><em class="citetitle">ATSread</em></a>, 
            <a class="link" href="ATSreadnz.html" title="ATSreadnz"><em class="citetitle">ATSreadnz</em></a>, 
            <a class="link" href="ATSinfo.html" title="ATSinfo"><em class="citetitle">ATSinfo</em></a>, 
            <a class="link" href="ATSsinnoi.html" title="ATSsinnoi"><em class="citetitle">ATSsinnoi</em></a>, 
            <a class="link" href="ATScross.html" title="ATScross"><em class="citetitle">ATScross</em></a>, 
            <a class="link" href="ATSinterpread.html" title="ATSinterpread"><em class="citetitle">ATSinterpread</em></a>, 
            <a class="link" href="ATSpartialtap.html" title="ATSpartialtap"><em class="citetitle">ATSpartialtap</em></a>, 
            <a class="link" href="ATSadd.html" title="ATSadd"><em class="citetitle">ATSadd</em></a>, 
            <a class="link" href="ATSaddnz.html" title="ATSaddnz"><em class="citetitle">ATSaddnz</em></a></p>
      </div>
      <div class="refsect1">
        <a id="idp90532896"></a>
        <h2>Credits</h2>
        <p>
            </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Alex Norman</td>
          </tr>
          <tr>
            <td>Seattle,Washington</td>
          </tr>
          <tr>
            <td>2004</td>
          </tr>
        </table>
        <p>
        </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="ATSaddnz.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="ATScross.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">ATSaddnz </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> ATScross</td>
        </tr>
      </table>
    </div>
  </body>
</html>
